package com.byb.server.service;

import com.byb.server.service.dto.ProductDTO;
import com.byb.server.domain.ProductDetails;
import com.byb.server.service.dto.ProductDetail;
import com.byb.server.service.dto.ProductDetailScoreDTO;
import com.byb.server.service.dto.Product_sort;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.Date;
import java.util.List;

/**
 * Service Interface for managing Product.
 */
public interface ProductService {

    /**
     * Save a product.
     *
     * @param productDTO the entity to save
     * @return the persisted entity
     */
    ProductDTO save(ProductDTO productDTO);

    /**
     *  Get all the products.
     *
     *  @param pageable the pagination information
     *  @return the list of entities
     */
    Page<ProductDTO> findAll(Pageable pageable);

    /**
     *  Get the "id" product.
     *
     *  @param id the id of the entity
     *  @return the entity
     */
    ProductDTO findOne(Long id);

    /**
     *  Delete the "id" product.
     *
     *  @param id the id of the entity
     */
    void delete(Long id);

    /**
     * Search for the product corresponding to the query.
     *
     *  @param query the query of the search
     *
     *  @param pageable the pagination information
     *  @return the list of entities
     */
    Page<ProductDTO> search(String query, Pageable pageable);

    /**
     * Search for the product corresponding to the query of KeyName.
     *
     *  @param query the query of the search of KeyName
     *
     *  @param pageable the pagination information
     *  @return the list of entities
     */
    Page<ProductDTO> findBywordKeysKeyName(String query, Pageable pageable);

    /**
     *  根据 orderByState 判断使用那种算法查询数据并排序
     * @param id
     * @param age
     * @param premiumPaymentPeriod
     * @param sexName
     * @param payment
     * @param orderByState
     * @param query
     * @param pageable
     * @return
     */
    ProductDetail findOneById(Long id, String age, Integer premiumPaymentPeriod, String sexName, Integer payment, Integer orderByState, Collection<Long> query, Pageable pageable);

    ProductDetail findById(Long id, String age, Integer premiumPaymentPeriod, String sexName, Integer payment, Integer orderByState, Collection<Long> query, Pageable pageable,boolean flag);

    ProductDetail findByIdRebuild(Long id,String age,  Integer premiumPaymentPeriod,  String sexName,  Integer payment,  Integer orderByState,  String query, boolean flag,Pageable pageable);

    /**
     *  评分逻辑，根据产品id 查询额外数据
     * @param id
     * @param productDetail  是ProductDetailScoreDTO 的局部数据
     * @return
     */
    ProductDetailScoreDTO findProductDetailScore(Long id , ProductDetail productDetail);

    ProductDetailScoreDTO findByIdDetailScore(Long id,String age,  Integer premiumPaymentPeriod,  String sexName,  Integer payment,  Integer orderByState,  String query, Pageable pageable);

    void delectProdcutAllInfo(Long id);



}
